package com.queue;

import java.util.Comparator;
import java.util.PriorityQueue;
class Mycomparator implements Comparator{

	@Override
	public int compare(Object obj1, Object obj2) {
		String s1=(String)obj1;
		String s2=obj2.toString();
		return s1.compareTo(s1);
	}
	
}
public class PriorityQueueDemo2 {
public static void main(String[] args) {
	PriorityQueue pq=new PriorityQueue<>(15,new Mycomparator());
	pq.offer("X");
	pq.offer("A");
	pq.offer("Z");
	pq.offer("B");
	System.out.println(pq);
}
}
